package com.smbms.util;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


//字符串转成日期
public class DateConverter implements Converter<String,Date> {

//格式转换
    public Date convert(String source) {

        SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd");

        try {
            Date parse = df.parse(source);
            return parse;
        } catch (ParseException e) {
            e.printStackTrace();
        }


        return null;
    }

}
